package com.slz3.business.module.configManagement.conActivityIndex.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.configManagement.conActivityIndex.domain.ConActivityIndex;
import com.slz3.business.module.configManagement.conActivityIndex.domain.ConActivityIndexFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class ConActivityIndexTransactionalServiceImpl implements ConActivityIndexTransactionalService {

    @Override
    public ConActivityIndex modify(ConActivityIndex conActivityIndexNew) {
        Repositorys.conActivityIndex.test();
        Repositorys.conActivityIndex.save(ConActivityIndexFactory.initBaseFields());
        System.err.println(1/0);
        conActivityIndexNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.conActivityIndex.saveAndFlush(conActivityIndexNew);
    }

    @Override
    public List<ConActivityIndex> batchModify(List<ConActivityIndex> conActivityIndexList) {
        return Repositorys.conActivityIndex.saveAll(conActivityIndexList);
    }
}
